'use strict';
//商家 其他相关 表
module.exports = {
  up: async (queryInterface, Sequelize) => {
    const { INTEGER, STRING, DATE, ENUM } = Sequelize;
    // 创建表
    await queryInterface.createTable('shop-config', {
      id: {
        type: INTEGER(30).UNSIGNED,
        primaryKey: true,
        autoIncrement: true
      },
      shop_id: {
        type: INTEGER(30).UNSIGNED,
        allowNull: false,
        comment: '商家id',
        //  定义外键（重要）
        references: {
          model: 'shop', // 对应表名称（数据表名称）
          key: 'id' // 对应表的主键
        },
        onUpdate: 'restrict', // 更新时操作
      },
      customer_total: {
        type: INTEGER(200),
        allowNull: false,
        defaultValue: 0,
        comment: '客户数量',
      },
      withd_amount: {
        type: STRING(200),
        allowNull: false,
        defaultValue: 0,
        comment: '提现金额',
      },
      total_amount: {
        type: STRING(200),
        allowNull: false,
        defaultValue: 0,
        comment: '总金额',
      },
      created_at: DATE,
      updated_at: DATE,
    });
  },
  down: async (queryInterface, Sequelize) => {
    await queryInterface.dropTable('shop-config');
  }
};
